﻿using CpsyV2Web.DataAccess;
using CpsyV2Web.Models;
using System.Linq;
using System.Web.Http;

namespace CpsyV2Web.Controllers
{
    public class PersonManageController : ApiController
    {
        /// <summary>
        /// 查询所有的用户信息
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        [HttpGet]
        public QueryData<Person> Get([FromUri]QueryPersonOptions value)
        {
            return value.RetrieveData();
        }
        /// <summary>
        /// 新增和修改用户信息
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        [HttpPost]
        public bool Post([FromBody]Person value)
        {
            return PersonHelper.SavePerson(value);
        }
        /// <summary>
        /// 删除用户信息
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        [HttpDelete]
        public bool Delete([FromBody]string value)
        {
            return PersonHelper.DeletePerson(value);
        }
    }
}
